<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
      <h2>{{msg}}</h2>

      <h2>使用过过滤 {{msg | format}}</h2>
      <h2>使用过过滤 {{msg2 | format}}</h2>

      <hr>

      <h2>使用过过滤且传值 {{msg | filterspreate('zs')}}</h2>
      <h2>使用过过滤且传值 {{msg2 | filterspreate('cxk')}}</h2>


  </div>
  <script src="./vue.js"></script>
  <script>
      Vue.filter('format',function(val) {
        if(val) {
            val = val.toString()
            return val.slice(0,5).toUpperCase() + val.slice(5)
        }
        return '空字符串 默认值'
      })

      Vue.filter('filterspreate',function(val,data) {
        console.log(val + '==>' + data);
        return data + val
      })

    var vm = new Vue({
      el:'#app',
      data:{
          msg:'msg1',
          msg2:"msg2"
      },
      methods:{
      }
     });
  </script>
</body>
</html>
